$(function() {

	var items = [ "tom", "two", "three", "four", "five", "Aiolos", "Chryses", "Mentor",
	              "Ajax", "Oedipus", "Sam", "George Smith",
	              "Pan", "Pluto", "Dionysus", "Menelaus", "Athene", "Electra"];
	new PeopleList().populateList(items);
});

function ItemHandler(item) {
	var self = this;
		
	this.initialize = function() {
		$(item).click(this.handleClick);
	};
	
	this.handleClick = function() {
		$(item).hide();
		return false;
	};
}

function PeopleList() {
	var self = this;
	
	this.populateList = function(items) {
		var itemList = "";
		jQuery.each(items, function() {
			var formattedItem = self.formatListItem(this);
			itemList += formattedItem;
		});	
		$("#list").html(itemList);

		jQuery.each("a", function() {
			new ItemHandler(this).initialize();
		});
	};

	this.formatListItem = function (item) {
		return '<a href="#">' + item + ': '+2;
	};
}

